package org.example.registry;

import org.example.registry.etcd.EtcdRegistry;
import org.example.spi.SpiLoader;

/**
 * @Author Jiangxiaonan
 * @Description 注册中心工厂，用于获取注册中心对象
 * @Date 2024/9/15 8:23
 **/
public class RegistryFactory {

    static {
        SpiLoader.load(IRegistry.class);
    }

    // 默认注册中心
    private static final IRegistry etcdRegistry = new EtcdRegistry();

    // 获取注册中心对象
    public static IRegistry getInstance(String key) {
        return SpiLoader.getInstance(IRegistry.class, key);
    }
}
